package com.atxiaodei.springbootmybatisplus.mapper;

import com.atxiaodei.springbootmybatisplus.entity.User;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @ClassName UserMapper
 * @Deacription TODO
 * @Author 王盟
 * @Date 2021/3/18 14:52
 * @Version 1.0
 **/
@Mapper
public interface UserMapper extends BaseMapper<User> {


    // 在对应的Mapper上面继承基本的类 Basemapper
    // 所有的crud操作都已经编写完成了
    // 你不需要像以前的配置一大堆的mapper文件了

    @Select("select us.id,us.name,us.age,ui.id,ui.telnumber,ui.hobby,ui.desc from user us LEFT JOIN userinfo ui on us.id=ui.id ${ew.customSqlSegment}")
    Page<Map<String,Object>> getCusPageSql(Page page, @Param(Constants.WRAPPER) Wrapper wrapper);
}
